home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trading on the Edge
/
Trading On The Edge - CD-ROM Toolkit (Wayzata Technology)(2031)(1994).bin
/
mac
/
Mac_Files
/
Vendor Demos
/
NeuralWare folder
/
nw2v50
/
fzartmap.c
< prev
next >
Wrap
Text File
|
1993-08-23
|
7KB
|
337 lines
/* fzartmap.c */
/************************************************************************
* Copyright(C) 1987-1992 NeuralWare Inc *
* Penn Center West, IV-227, Pittsburgh, PA 15276 *
* Telephone: (412) 787-8222 FAX: (412) 787-8220 *
* *
* All rights reserved. No part of this program may be reproduced, *
* stored in a retrieval system, or transmitted, in any form or by any *
* means, electronic, mechanical, photocopying, recording or otherwise *
* without the prior written permission of the copyright owner, *
* NeuralWare, Inc. *
* *
* PROPRIETARY NOTICE *
* *
* This document is the property of NeuralWare, Inc. and contains *
* trade-secrets and other proprietary information. The information *
* herein is reserved as proprietary to NeuralWare, and is not to be *
* published, reproduced, copied, disclosed, used, or reverse *
* engineered without the express written consent of a duly authorized *
* representative of NeuralWare. *
************************************************************************
*/
#define UIO_SERVER 1
#define SERVER_EMULATOR_FILE 1
#define SKIP_COMPAT_DATA 1
#include "userutl.h"
#include "uio_strc.h"
#include "uio_tran.h"
#include "uio_reqs.pro"
#include "uio_cmds.pro"
#include <math.h>
#ifdef MAC
#include "macuio.redef"
#endif
int W_Wid = {200}; /* basic defining parameters */
int W_Ht = {200}; /* height of graph */
int count = 0;
int good_count = 0;
float xin, yin, desval;
TEXT sbuf[100];
int circ_color;
int back_color;
int on_color;
int off_color;
#define W0 1
#define W1 2
#define UPDT_INTERVAL 100
NINT UIO_Init(file)
TEXT *file;
{
NINT ret_val = UIO_OK;
NINT xsize, ysize, ncolor, chrx, chry; /* graphics parameters */
/* Get screen parameters */
ug_gparms( &xsize, &ysize, &ncolor, &chrx, &chry);
if ( ncolor < 8 ) {
circ_color = 1;
back_color = 0;
on_color = 1;
off_color = 0;
} else {
circ_color = 1;
back_color = 0;
on_color = 6;
off_color = 5;
}
/* Set up windows */
ug_window(W0, back_color, 20, 100, 20+W_Wid, 100+W_Ht);
ug_window(W1, back_color, 20, 75, 20+W_Wid, 99);
return(ret_val);
}
NINT UIO_Term(process)
NINT process;
{
NINT ret_val = UIO_OK;
return(ret_val);
}
NINT UIO_Attention()
{
NINT ret_val = UIO_OK;
return(ret_val);
}
NINT UIO_Learn_Start()
{
NINT ret_val = UIO_OK;
/* Set up learn file */
ug_fileio("circ_trn", 0, 1, 1, 1);
count = 0;
return(ret_val);
}
NINT UIO_Learn_Input(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
return(ret_val);
}
NINT UIO_Learn_Output(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
return(ret_val);
}
NINT UIO_Learn_Result(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT n_cn_vals;
SREAL cn_vals[10];
NINT ret_val = UIO_OK;
NINT wx;
count++;
if (count%UPDT_INTERVAL != 0)
return(ret_val);
ug_winclr(W0);
ug_winclr(W1);
ug_circle(W0,circ_color,0,W_Wid/2,W_Ht/2, (4*W_Wid)/10,
circ_color==on_color?0:1);
for (wx=0; wx<1000; wx++) {
APE ape;
/* Get PE information from category layer */
if (ug_peio(&ape, 0, 2, wx) != 0 ||
ape.ape_Flags&0x0001) break;
n_cn_vals = 4;
ug_cnio(2,wx,1,0,&n_cn_vals,0,0,cn_vals);
ug_box(W0, on_color, 0,
(NINT)(cn_vals[0]*W_Wid),
(NINT)(cn_vals[1]*W_Ht),
(NINT)((1-cn_vals[2])*W_Wid),
(NINT)((1-cn_vals[3])*W_Ht),
0);
}
/* Now display the category count */
sprintf(sbuf, "%ld ART Categories", (long)wx);
ug_puts(W1,on_color,0,15,4,sbuf,0);
return(ret_val);
}
NINT UIO_Learn_End()
{
NINT ret_val = UIO_OK;
PutStr("Hit <Enter> to continue:");
GetStr( );
return(ret_val);
}
NINT UIO_Recall_Start()
{
NINT ret_val = UIO_OK;
TEXT *sp;
PutStr("Test Set (T) or Training Set (L)?: ");
sp = GetStr( );
if (sp[0] == 'l' || sp[0] == 'L')
ug_fileio("circ_trn", 1, 0, 0, 0);
else
ug_fileio("circ_tst", 1, 0, 0, 0);
ug_winclr(W0);
ug_winclr(W1);
ug_circle(W0,15,0,W_Wid/2,W_Ht/2, (4*W_Wid)/10,0);
count = 0;
good_count = 0;
return(ret_val);
}
NINT UIO_Read(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* Since this is file IO, the data should already be in the buffer */
xin = Datap[0];
yin = Datap[1];
desval = -1.0;
return(ret_val);
}
NINT UIO_Write(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
SREAL outval;
NINT x0, y0;
outval = Datap[0];
x0 = xin*W_Wid;
y0 = yin*W_Ht;
ug_box(W0, outval>0.5?on_color:off_color,0,
x0-1,y0-1,x0+1,y0+1,0);
if (desval >-0.5) {
count ++;
if (fabs(desval-outval) < 0.1)
good_count++;
}
return(ret_val);
}
NINT UIO_Write_Step(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
return(ret_val);
}
NINT UIO_Recall_Test(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* Since this is file IO, the data should already be in the buffer */
desval = Datap[0];
return(ret_val);
}
NINT UIO_Recall_End()
{
NINT ret_val = UIO_OK;
ug_circle(W0,15,0,W_Wid/2,W_Ht/2, (4*W_Wid)/10,0);
if (count > 0) {
sprintf(sbuf,"%5.2f%% Correct",
100.0 * ( ((float)good_count) / ((float)count) ) );
ug_puts(W1,on_color,0,15,4,sbuf,0);
} else {
PutStr("If you want classification rate, run in Test Mode.\n");
}
PutStr("Hit <Enter> to continue:");
GetStr( );
return(ret_val);
}
NINT UIO_Instrument(Instrument_id, nDataElems, DataElemp)
NINT Instrument_id;
NINT nDataElems;
SREAL *DataElemp;
{
NINT ret_val = UIO_OK;
return(ret_val);
}
/* FUNCTION */
NINT UIO_ObjFunc(eoeflag, DataElemp)
NINT eoeflag;
SREAL *DataElemp;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
NINT UIO_Rewind()
{
NINT ret_val = UIO_OK;
return(ret_val);
}
NINT UIO_Explain(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
return(ret_val);
}